package lombook;

import lombok.Cleanup;
import lombok.SneakyThrows;

import java.io.*;

public class LomBokTest {
    // 异常捕获
    @SneakyThrows
    public static void main(String[] args) {
            File file = new File("d:\\test.txt");
            //自动关闭 IO
            @Cleanup InputStream inputStream = new FileInputStream(file);
            @Cleanup InputStreamReader reader = new InputStreamReader(inputStream,"GBK");
            @Cleanup BufferedReader br = new BufferedReader(reader);
            String line;
            while ((line = br.readLine()) != null) {
                System.out.println(line);
            }

    }
}
